package com.gsbelarus.gedemin.income.activity;

import android.app.FragmentTransaction;
import android.os.Bundle;
import android.view.Menu;

import com.gsbelarus.gedemin.income.R;
import com.gsbelarus.gedemin.income.fragment.SettingsFragment;

public class Settings extends SyncActivity {

    private SettingsFragment fragment;

    @Override
    public int getViewId() {
        return R.layout.activity_frgm;
    }

    @Override
    public String getTitleString() {
        return getString(R.string.action_settings);
    }

    @Override
    public void onFinishUpdateDB() {
        fragment.setEnabledDataBaseButton(true);

    }

    @Override
    public void onStartUpdateDB() {
        super.onStartUpdateDB();
        fragment.setEnabledDataBaseButton(false);
    }

    /**
     * вызывается в методе onCreate(Bundle)
     *
     * @param arguments bundle с агрументами
     */
    @Override
    public void onCreateActivity(Bundle arguments) {
        super.onCreateActivity(arguments);
        setShowingSyncStatusDialog(true);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);

        fragment = new SettingsFragment();
        FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
        fragmentTransaction.replace(R.id.frgm_content, fragment);
        fragmentTransaction.commit();
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        return true;
    }
}
